/*
 * HelpWindow.java
 *
 * Created on 22 de febrero de 2007, 2:44
 */

package ub.es.ubictionary.visual;

import java.awt.Dimension;
import java.awt.Toolkit;
import java.io.File;
import java.io.IOException;
import java.net.URL;

/**
 *
 * @author  aram
 */
public class HelpWindow extends javax.swing.JDialog {
    
    /** Creates new form HelpWindow */
    public HelpWindow(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        this.setTitle("Ayuda de UBictionary Manager");
        
        initComponents();
        try {
            jEditorPane1.setPage(getCurrentDir() + "/help.html");
        } catch (IOException ex) {
            ex.printStackTrace();
        }
        Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
        this.setLocation((int) (d.width-this.getWidth())/2, (int) (d.height - this.getHeight())/2 );
    }

    
    public URL getCurrentDir() { 
        File dir1 = new File ("."); 
        URL strCurrentDir = null;
        try { 
            strCurrentDir = dir1.toURL();
        } catch(Exception e) { 
            e.printStackTrace(); 
        } 
        return strCurrentDir; 
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
    private void initComponents() {
        jScrollPane1 = new javax.swing.JScrollPane();
        jEditorPane1 = new javax.swing.JEditorPane();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        jEditorPane1.setEditable(false);
        jScrollPane1.setViewportView(jEditorPane1);

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 495, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 500, Short.MAX_VALUE)
        );
        pack();
    }// </editor-fold>//GEN-END:initComponents
    
 
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JEditorPane jEditorPane1;
    private javax.swing.JScrollPane jScrollPane1;
    // End of variables declaration//GEN-END:variables
    
}
